<?php

// -----------------------------------------------------------------------------

include "config/config.php";
include "global/globalAuth.php";
include "createDBIfNotExists.php";

// -----------------------------------------------------------------------------

// 设置时区
ini_set('date.timezone', $timezone);
// 取得今日日期
$today = date('Y-m-d');

// -----------------------------------------------------------------------------

?>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>批量制定单词复习计划</title>
    <link rel="stylesheet" href="resources/bootstrap-4.3.1-dist/css/bootstrap.min.css">
</head>
<body>

<!-- ----------------------------------------------------------------------- -->

<?php include 'global/globalNavBar.php'; ?>

<!-- ----------------------------------------------------------------------- -->

<div class="container mt-2">

    <form action="editAddWordsFormAction.php" method="post" class="form-group mt-2">

        <div>

            <div>
                <div>
                    <label for="inputDate">起始记忆日期：</label>
                </div>
                <div>
                    <input id="inputStartDate"
                           name="startDate"
                           type="date"
                           class="form-control form-control-sm" tabindex="1"
                           value="<?php echo $today; ?>"
                           required>
                </div>
            </div>

            <div>
                <div class="mt-2">
                    <label for="inputDailyVolume">每日记忆量：</label>
                </div>
                <div>
                    <input id="inputDailyVolume"
                           name="dailyVolume"
                           type="number"
                           min="1"
                           class="form-control form-control-sm" tabindex="2"
                           value="10"
                           required>
                </div>
            </div>

            <div class="form-group mt-2">
                <label for="selectOrder">单词顺序：</label>
                <select name="order" class="form-control form-control-sm" id="selectOrder" tabindex="3" required>
                    <option value="order">正常顺序</option>
                    <option value="random">随机乱序</option>
                </select>
            </div>

            <div class="mt-2">
                <textarea name="contents"
                          id="inputcontents"
                          cols="30"
                          rows="10"
                          class="form-control mt-2"
                          autofocus
                          tabindex="4"
                          placeholder="在此批量输入要加入背诵计划的生词，不同的词汇之间按回车键分隔。后台会忽略空行。"
                          required></textarea>
            </div>

        </div>

        <div class="mt-2">
            <button type="submit" class="btn btn-sm btn-outline-primary" tabindex="4">生成</button>
            <button id="btnReset" type="button" class="btn btn-sm btn-outline-secondary" tabindex="5">清空</button>
        </div>

    </form>

</div>

<!-- ----------------------------------------------------------------------- -->

<script src="resources/jquery/jquery-3.4.0.min.js"></script>
<script src="resources/bootstrap-4.3.1-dist/js/bootstrap.min.js"></script>

<!-- ----------------------------------------------------------------------- -->

<script>
    // 点击清空按钮时执行的动作
    $('#btnReset').click(function () {
        $('#inputcontents').val('');
        $('#inputcontents').focus();
    })
</script>

<!-- ----------------------------------------------------------------------- -->

</body>
</html>